<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>定位 旋转</title>
    <link rel="stylesheet" href="css/style_init.css">
    <style>
        .box1 {
            position: relative;
            /* display: inline-block; */
            width: 500px;
            height: 500px;
            background-color: aqua;
            /* transform: translate(20px, 30px); */
        }
        .box1 p {
            position: absolute;
            top: 50%;
            left: 50%;
            width: 200px;
            height: 200px;
            transform: translate(-50%, -50%);
            background-color: antiquewhite;
        }
        .box2 {
            position: relative;
            width: 100px;
            height: 100px;
            border: 1px solid #aaa;
            border-radius: 50%;
        }
        .box2 p {
            position: absolute;
            top: 50%;
            left: 50%;
            width: 60px;
            height: 60px;  
            transform: translate(-50%, -50%);
            background-color: brown;
            transition: all .5s;
        }
        .box2:hover p {
            transform: translate(-50%, -50%) rotate(45deg);
            /* transform: rotate(45deg); */
        }
        .box3 {
            width: 200px;
            height: 200px;
            background-color: pink;
            transition: all .5s;
            transform-origin: right center;
        }
        .box3:hover {
            transform: rotate(360deg);
        }
    </style>
</head>
<body>
    <div class="box1">
        <p></p>
    </div>
    <div class="box2">
        <p></p>
    </div>
    <div class="box3"></div>
</body>
</html>